package fitness;

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

import character.Rogue;

public class RogueFitness extends FitnessFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2812183590908653964L;

	@Override
	protected double evaluate(IChromosome profile) {
		Integer strength = (Integer) profile.getGene(0).getAllele();
		Integer agility =  (Integer) profile.getGene(1).getAllele();
		Integer stamina =  (Integer) profile.getGene(2).getAllele();
		Integer intellect =  (Integer) profile.getGene(3).getAllele();
		Integer spirit =  (Integer) profile.getGene(4).getAllele();
		
		Rogue rogue = new Rogue();
		rogue.setStrength(strength);
		rogue.setAgility(agility);
		rogue.setStamina(stamina);
		rogue.setIntellect(intellect);
		rogue.setSpirit(spirit);
		
		double res = 7.958  * rogue.getAttackPower() +
					  9.610  * rogue.getArmor() + 
					 27.025  * rogue.getSpeed() +
					 15.915  * rogue.getResilience() + 
					 21.720  * rogue.getDodgeRating() + 
					 0.000  * rogue.getMana() +
					 1.857 * rogue.getHealth() +
					 0.000 * rogue.getSpellPenetration() +
					 0.000  * rogue.getHaste() + 
					 15.915  * rogue.getHealthRegeneration() +
					 0.000  * rogue.getManaRegeneration();
		return res;
	}

}
